<script setup>
import { ref } from 'vue'
import {Tickets} from '@element-plus/icons-vue'
const props = defineProps({
  cardData:{
    type: Object,
    default: () => {
      return {
        title: '标题',
        subTitle: '内容',
      }
    },
  },
  showFooter: {
    type: Boolean,
    default: true,
  },
  icon: {
    type: Boolean,
    default: false,
  },
  index: {
    type: Number,
    default: 0,
  }
})
console.log(props.cardData.createTime)
const emits = defineEmits(['edit','delete'])
</script>

<template>
    
<div class="card-main">
    <div class="card-header">
        <div class="card-icon">
            <el-icon v-if="!icon" ><Tickets /></el-icon>
            <slot v-else name="icon"></slot>
        </div>
        <div class="card-title">
            <div class="card-title-main">{{cardData.resumeName}}</div>
            <div class="card-title-sub">创建于:{{new Date(cardData.createTime).toLocaleString()}}</div>
        </div>
       
    </div>
    <div class="card-footer">
         <div class="card-footer-btn" v-if="showFooter">
            <el-button type="primary" class="card-footer-btn-edit" plain @click="emits('edit',cardData)">编辑</el-button>
            <el-button type="warning" class="card-footer-btn-delete" plain @click="emits('delete',index)">删除</el-button>
        </div>
    </div>
</div>
</template>

<style scoped>

.card-title-main{
    font-size: 20px;
    color: rgb(243, 244, 246);
    margin-bottom: 8px;
    font-weight: bolder;
    text-align: center;
}
.card-title-sub{
    font-size: 14px;
    color: rgb(156, 163, 175);
    margin-bottom: 30px;
        text-align: center;

}
.card-main{
    width: 100%;
    height: 260px;
    
    min-width: 200px;
    background-color: rgb(3, 7, 18);
    border-radius: 10px;
    border: 1px rgb(31, 41, 55) solid;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
    transition: 0.5s cubic-bezier(0.075, 0.82, 0.165, 1);
}
.card-header{
    display: flex;
    flex-direction: column;
    justify-content: center;

    align-items: center;
}
.card-icon{
    font-size: 30px;
    color: var(--el-color-primary);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(109, 40, 217, 0.1);
    border: 1px rgb(31, 41, 55) solid;
    text-align: center;
    margin-bottom: 16px;
    transition: 0.3s linear;
}
.card-footer-btn{
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    height: 36px;
}
.card-footer-btn button{
    width: 45%;
    height: 100%;
}
.card-footer-btn button:hover{
    color: var(--el-color-primary);
}
.card-footer-btn-delete{
background-color: rgb(31, 41, 55);
}
.card-footer-btn-edit{
    background-color: rgb(31, 41, 55);
}
.card-main:hover{
    border: 1px var(--el-color-primary) solid;
    background-color:rgba(109, 40, 217,0.1) ;
    transform: scale(1.05);
}
.card-icon:hover{
    
    transform:rotate(90deg);
}
</style>
